Skip to content

Fix Clang warnings by using proper function prototypes in macros #179

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 30, 2025

Conversation

ShravanDeva5327
Copy link
Contributor

@ShravanDeva5327 ShravanDeva5327 commented May 23, 2025

This PR updates the macros to specify (void) in argument lists for functions that take no arguments. This resolves warnings from
Clang(-Wstrict-prototypes).

Tested locally with Clang; no build issues observed.

Closes #178
Supersedes #115

Copy link
Contributor

@fujitatomoya fujitatomoya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ShravanDeva5327 change looks good to me, but DCO is missing. can you address that?

@ShravanDeva5327
Copy link
Contributor Author

@fujitatomoya I forgot to sign off the commit. I've added it now.

@christophebedard christophebedard self-requested a review May 23, 2025 16:02
@christophebedard
Copy link
Member

By the way, it's good practice to reference any relevant issue or PR in the PR description. This way, reviewers can get the whole context behind a change. This also applies when creating issues, of course.

In this case, since this PR supersedes #115 (and since my comments on that PR may be relevant for this PR), it would be good to include "Supersedes #115" on a separate line in the PR description.

@ShravanDeva5327
Copy link
Contributor Author

By the way, it's good practice to reference any relevant issue or PR in the PR description. This way, reviewers can get the whole context behind a change. This also applies when creating issues, of course.

In this case, since this PR supersedes #115 (and since my comments on that PR may be relevant for this PR), it would be good to include "Supersedes #115" on a separate line in the PR description.

That makes sense, I’ve edited the PR description, and I’ll make sure to reference related issues or PRs in the future too

@christophebedard
Copy link
Member

Oh, and you can also include "Closes #178" in the PR description (again on a separate line). This way, the #178 issue will automatically get closed when this PR gets merged!

@ShravanDeva5327
Copy link
Contributor Author

This should hopefully resolve the warnings. Since I'm not able to reproduce them locally, I can't confirm if they're fully resolved.

@christophebedard Could you please trigger the CI job manually to check?

Copy link
Member

@christophebedard christophebedard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried in an Ubuntu 24.04 Docker container and it seems like your new changes did the trick!

Here's a new job to validate that the warnings went away:

  • nightly_linux_clang_libcxx Build Status

If that looks good, I'll run full CI after you apply my suggestion.

@christophebedard
Copy link
Member

There seem to be weird issues with downloading from http://archive.ubuntu.com in the nightly_linux_clang_libcxx job. I retriggered it a second time.

@christophebedard
Copy link
Member

christophebedard commented May 28, 2025

..and I just remembered that I should use ci_linux_clang_libcxx instead of nightly_linux_clang_libcxx for manually-triggered jobs 😬

@christophebedard
Copy link
Member

It failed once again due to an infrastructure issue. Here's a ci_linux_clang_libcxx job instead:

  • ci_linux_clang_libcxx Build Status

@christophebedard
Copy link
Member

That failed again due to issues connecting to archive.ubuntu.com. Let's just wait a bit.

Signed-off-by: Shravan Deva <[email protected]>
@ShravanDeva5327
Copy link
Contributor Author

That failed again due to issues connecting to archive.ubuntu.com. Let's just wait a bit.

Looks like the same issue is causing GitHub actions to fail

  Err:1 http://archive.ubuntu.com/ubuntu noble-updates/main amd64 libapparmor1 amd64 4.0.1really4.0.1-0ubuntu0.24.04.4
    Connection failed [IP: 91.189.91.82 80]
  Err:2 http://archive.ubuntu.com/ubuntu noble/main amd64 sudo amd64 1.9.15p5-3ubuntu5
    Connection failed [IP: 185.125.190.83 80]
  E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/a/apparmor/libapparmor1_4.0.1really4.0.1-0ubuntu0.24.04.4_amd64.deb  Connection failed [IP: 91.189.91.82 80]
  E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/s/sudo/sudo_1.9.15p5-3ubuntu5_amd64.deb  Connection failed [IP: 185.125.190.83 80]
  E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

@ahcorde
Copy link
Contributor

ahcorde commented May 29, 2025

  • ci_linux_clang_libcxx Build Status

Copy link
Member

@christophebedard christophebedard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me now, thanks for iterating!

Now it's just about validating that this fixes the clang warnings (which I think it should) and then running full CI.

@christophebedard
Copy link
Member

The warnings indeed disappeared! https://ci.ros2.org/view/manual/job/ci_linux_clang_libcxx/85/clang/

Now I'll trigger full CI.

@christophebedard
Copy link
Member

Pulls: #179
Gist: https://gist.githubusercontent.com/christophebedard/21ac843a08ababb31d6b90d0dfdad86f/raw/17e9b7e0005b9df94c92e8d33f4cb5849e71ec2f/ros2.repos
BUILD args: --packages-above-and-dependencies tracetools
TEST args: --packages-above tracetools
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/16119

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

Copy link
Contributor

@ahcorde ahcorde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for fixing this!

@ahcorde ahcorde merged commit 2ca74e7 into ros2:rolling May 30, 2025
6 of 19 checks passed
@ahcorde
Copy link
Contributor

ahcorde commented May 30, 2025

https://github.com/Mergifyio backport kilted

Copy link

mergify bot commented May 30, 2025

backport kilted

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request May 30, 2025
@ShravanDeva5327 ShravanDeva5327 deleted the fix-clang-warnings branch May 30, 2025 09:22
@christophebedard
Copy link
Member

Thank you for fixing this!

Yes, thank you @ShravanDeva5327!

ahcorde pushed a commit that referenced this pull request May 30, 2025
… (#180)

(cherry picked from commit 2ca74e7)

Signed-off-by: Shravan Deva <[email protected]>
Co-authored-by: Shravan Deva <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix clang/gcc warnings
4 participants